﻿<!doctype html>
<html>
<head>
<meta charset="utf-8">

<title>绘制图片-预加载</title>
<style>
body {text-align:center; background:black;}
#c1 {background:white;}
</style>
<script>
window.onload=function ()
{
	var oC=document.getElementById('c1');
	var gd=oC.getContext('2d');
	var oImg=new Image();
	
	oImg.onload=function ()
	{
		gd.drawImage(oImg, 0, 0);
	};
	oImg.src='1.jpg';
};
</script>
</head>

<body>
<canvas id="c1" width="800" height="600"></canvas>
</body>
</html>
